<?php
$id = isset($_GET['id']) ?  $_GET['id'] : '' ;
$pn = isset($_GET['pn']) ?  $_GET['pn'] : '' ;
if(!empty($id) && !empty($pn)) {
	//$file_content = iconv('GBK', 'UTF-8', file_get_contents('test/test-' . $pn . '.html'));
	$file_content = file_get_contents('test/test-' . $pn . '.html');
	$file_content = str_replace('<BODY ', '<BODY style="margin:10px 0px;" ', $file_content);
	$file_content = str_replace('src="', 'src="/pdfread/test/', $file_content);
	//$file_content = str_replace(array(';left:','"><nobr><span', '<IMG', ':8px;', 'charset=GBK'), array('px;left:','px;"><nobr><span', '<IMG style="margin-top:8px;"', ':10px;', 'charset=utf-8'), $file_content);
	$file_content = str_replace(array(';left:','"><nobr><span'), array('px;left:','px;"><nobr><span'), $file_content);
	$file_content = preg_replace('/\.ft(\d+)\{/i', '.ft$1' . '_' . $pn . '{', $file_content);
	$file_content = preg_replace('/class="ft(\d+)"/i', 'class="ft$1' . '_'.$pn.'"', $file_content);
	header("Content-type: text/html; charset=utf-8");
	echo $file_content;
}